//
//  BPComboDetailView.m
//  BabyPhotograph
//
//  Created by cesh on 2017/1/9.
//  Copyright © 2017年 cesh. All rights reserved.
//

#import "BPComboDetailView.h"
#import <UIImageView+WebCache.h>
@interface BPComboDetailView()

@property (weak, nonatomic) IBOutlet UIImageView *img1;
@property (weak, nonatomic) IBOutlet UILabel *lbl1;
@property (weak, nonatomic) IBOutlet UIImageView *img2;
@property (weak, nonatomic) IBOutlet UILabel *lbl2;
@property (weak, nonatomic) IBOutlet UIImageView *img3;
@property (weak, nonatomic) IBOutlet UILabel *lbl3;
@property (weak, nonatomic) IBOutlet UIImageView *img4;
@property (weak, nonatomic) IBOutlet UILabel *lbl4;
@property (weak, nonatomic) IBOutlet UIImageView *img5;
@property (weak, nonatomic) IBOutlet UILabel *lbl5;
@property (weak, nonatomic) IBOutlet UIImageView *img6;
@property (weak, nonatomic) IBOutlet UILabel *lbl6;
@property (weak, nonatomic) IBOutlet UIImageView *img7;
@property (weak, nonatomic) IBOutlet UILabel *lbl7;
@property (weak, nonatomic) IBOutlet UILabel *lbl7_des;
@property (weak, nonatomic) IBOutlet UIImageView *img8;
@property (weak, nonatomic) IBOutlet UILabel *lbl8;
@property (weak, nonatomic) IBOutlet UILabel *lbl8_des;



@end

@implementation BPComboDetailView

- (void)awakeFromNib {
    [super awakeFromNib];
    
    //添加点击背景消失的方法
    UITapGestureRecognizer *remove = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(remove)];
    [self addGestureRecognizer:remove];
    
}

- (void)setData:(NSArray *)serveArray {
    NSLog(@"%@", serveArray);
    [_img1 sd_setImageWithURL:[NSURL URLWithString:serveArray[0][@"imgs"][0]] placeholderImage:[UIImage imageNamed:@"zhanweitu"]];
    _lbl1.text = serveArray[0][@"title"];
    [_img2 sd_setImageWithURL:[NSURL URLWithString:serveArray[1][@"imgs"][0]] placeholderImage:[UIImage imageNamed:@"zhanweitu"]];
    _lbl2.text = serveArray[1][@"title"];
    [_img3 sd_setImageWithURL:[NSURL URLWithString:serveArray[2][@"imgs"][0]] placeholderImage:[UIImage imageNamed:@"zhanweitu"]];
    _lbl3.text = serveArray[2][@"title"];
    [_img4 sd_setImageWithURL:[NSURL URLWithString:serveArray[3][@"imgs"][0]] placeholderImage:[UIImage imageNamed:@"zhanweitu"]];
    _lbl4.text = serveArray[3][@"title"];
    [_img5 sd_setImageWithURL:[NSURL URLWithString:serveArray[4][@"imgs"][0]] placeholderImage:[UIImage imageNamed:@"zhanweitu"]];
    _lbl5.text = serveArray[4][@"title"];
    [_img6 sd_setImageWithURL:[NSURL URLWithString:serveArray[5][@"imgs"][0]] placeholderImage:[UIImage imageNamed:@"zhanweitu"]];
    _lbl6.text = serveArray[5][@"title"];
    
    [_img7 sd_setImageWithURL:[NSURL URLWithString:serveArray[6][@"imgs"][0]] placeholderImage:[UIImage imageNamed:@"zhanweitu"]];
    _lbl7.text = serveArray[6][@"title"];
    NSString *text = serveArray[6][@"desc"];
    text = [text stringByReplacingOccurrencesOfString:@"<br>" withString:@"\n"];
    _lbl7_des.text = text;
    
    [_img8 sd_setImageWithURL:[NSURL URLWithString:serveArray[7][@"imgs"][0]] placeholderImage:[UIImage imageNamed:@"zhanweitu"]];
    _lbl8.text = serveArray[7][@"title"];
    text = serveArray[7][@"desc"];
    text = [text stringByReplacingOccurrencesOfString:@"<br />" withString:@"\n"];
    _lbl8_des.text = text;
}
- (void)remove {
    [self removeFromSuperview];
}

@end
